//
//  HomePageViewController.m
//  SweetComics
//
//  Created by LeeZhe on 15/1/28.
//  Copyright (c) 2015年 LeeZhe. All rights reserved.
//

#define kHotURL @"http://mobilev3.ac.qq.com/Classify/categoryList/category_id/50007/listcnt/12/page/1/clientType/0"
#import "HomePageViewController.h"
#import "FirstView.h"
#import "ListOneCell.h"
#import "TotalCell.h"
@interface HomePageViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,retain)NSMutableArray *arr;
@property (nonatomic,retain)UITableView *tableView;

@end

@implementation HomePageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createView];
}
- (void)createView
{
    FirstView *first = [[FirstView alloc] initWithFrame:CGRectMake(0,50, self.view.frame.size.width,290)];
    //    first.backgroundColor = [UIColor redColor];
    [first createView];
    //    first.backgroundColor = [UIColor redColor];
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(10,0,self.view.frame.size.width - 20, self.view.frame.size.height) style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableHeaderView = first;
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(first.frame.size.width - 100, 15,100,40);
    [button setTitle:@"漫画列表" forState: UIControlStateNormal];
    [first addSubview:button];
    button.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.view addSubview:_tableView];
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return 200;
    }
    return 40;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 8;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static  NSString *r = @"r";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:r];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:r];
    }
    if (indexPath.row == 0) {
        static NSString *a = @"a";
        ListOneCell *cellOne = [self.tableView dequeueReusableCellWithIdentifier:a];
        if (!cellOne) {
            cellOne = [[ListOneCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:a];
        }
        [cellOne setPicture];
        return cellOne;
    }
    if (indexPath.row == 1) {
        static NSString *shaonian = @"少年";
        TotalCell *totalCell = [self.tableView dequeueReusableCellWithIdentifier:shaonian];
        if (!totalCell) {
            totalCell = [[TotalCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:shaonian];
        }
        [totalCell setTotal];
        return totalCell;
    }
    return cell;
    
}


/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
